<template>
    <div class="page-container">
        <div class="news-header">
            <div class="news-title">{{newsContent.Theme}}</div>
            <div class="news-tips">
                <div class="news-time" v-if="newsContent.Time!=null">{{newsContent.Time}}</div>
                <div class="news-time" v-else>&nbsp;&nbsp;</div>
                <div class="news-view">{{newsContent.Pageview}}&nbsp;&nbsp;浏览</div>
            </div>
        </div>
        <div class="news-img">
            <img :src="newsContent.ThemeImage" alt="">
        </div>
        <div class="news-text" v-html="newsContent.Content"></div>
        <div class="news-share">
            <div class="share-btn" @click="shareNews">
                <span>分享</span>
                <img src="../assets/img/icon_share.png" alt="">
            </div>
        </div>
    </div>
</template>

<script>
import axios from 'axios'
import wx from 'weixin-js-sdk'
export default {
    name:'newsDetail',
    data(){
        return {
            newsContent:{}
        }
    },
    created(){
        var that = this
        if(this.$route.query.id&&this.$route.query.id!=''){
            axios({
                method:'GET',
                url:that.baseUrl+'/api/consult/getNewsById/'+that.$route.query.id
            }).then(res=>{
                console.log(res)
                that.newsContent = res.data
            }).catch(err=>{
                console.log(err)
            })
        }
        
    },
    methods:{
        shareNews(){
            var that = this
            wx.miniProgram.navigateTo({ url: '/pages/minShare/minShare?id='+ that.$route.query.id});
        }
    }
}
</script>

<style>
@import '../assets/css/style.css';
</style>
